<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use app\assets\AppAsset;

/* @var $this yii\web\View */
/* @var $model app\models\Company */

$this->title ='用户信息';
//$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-view">

    <h1><?= Html::encode($this->title) ?></h1>
<?php
$model=Yii::$app->user->identity;
if($model->person->company_id!=0){
    $label1='公司员工';
    $label2='所属公司';
    $value=$model->person->company->name;
}else if($model->person->park_id!=0){
    $label1='园区员工';
    $label2='所属园区';
    $value=$model->person->park->name;
}else if($model->person->park_id!=0){
    $label1='地块员工';
    $label2='所属地块';
    $value=$model->person->land->name;
}else{
    $label1='平台员工';
    $label2='所属部门';
    $value="上海邦伯公司开发部门";

}
$roles=yii::$app->authManager->getRolesByUser(1);
$level="";
foreach($roles as $role=>$object)
{
    $level.=" ".$role;
}
?>

<?= DetailView::widget([
    'model' => $model,
    'attributes' => [
        'username',
        'email',
        [
            'label'=>'姓名',
            'value'=>$model->person->name,
        ],
        [
            'label'=>'员工类别',
            'value'=>$label1,
        ],
        [
            'label'=>'员工级别',
            'value'=>$level,
        ],
        [
            'label'=>$label2,
            'value'=>$value,
        ],
        // 'qualification_image',
    ],
]) ?>